package com.example.work2;

import androidx.appcompat.app.AppCompatActivity;

import android.accessibilityservice.AccessibilityService;
import android.app.ActivityManager;
import android.content.Context;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView mMemory = (TextView) findViewById(R.id.Memory);

//        ActivityManager am = (ActivityManager) MainActivity.this.getSystemService(Context.ACTIVITY_SERVICE);
//        ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
//        am.getMemoryInfo(mi);
//        Toast.makeText(MainActivity.this, "启动"+mi.totalMem* 1.0/ (1024 * 1024), Toast.LENGTH_SHORT).show();
//        Toast.makeText(MainActivity.this, "启动"+mi.availMem * 1.0/ (1024 * 1024), Toast.LENGTH_SHORT).show();
//        Toast.makeText(MainActivity.this, "启动"+mi.availMem*100/mi.totalMem, Toast.LENGTH_SHORT).show();
        mMemory.setText("内存已使用:"+(100-BootCompleteReceiver.MEMORY)+"%");
    }
}